<?php
require('../include/init.inc.php');
$method = $service = '';
extract($_REQUEST, EXTR_IF_EXISTS);

if (Common::isPost()) {

    $update_data = array();
    if (!empty($service)) {
        $update_data['online_service'] = $service;
    }


    $ret = AdminOnService::online_service();
    if ($ret) {
        $result = AdminOnService::replace($update_data, $ret['id']);
    } else {
        $data = array("online_service" => $service);
        $result = AdminOnService::insert($data);
    }

    if ($result) {
        SysLog::addLog(UserSession::getUserName(), 'Add', 'OnlineService', $service, json_encode($update_data));
        Common::exitWithSuccess('添加完成', 'one_page_shop/online_service.php');
    } else {
        OSAdmin::alert("error");
    }
}

Template::display('one_page_shop/online_service.tpl');